By Dimitre Novatchev |
Language | XSLT |
Category | designpatterns, xml, msxml |
Posted | 26 Feb 2001 |
Updated | 05 Mar 2001 |
Summary | ||||||||||
This snippet shows how given a set of name/value pairs for a record from a set of records, to "reconstitute" the whole records. | ||||||||||
This problem was first formulated by my friend Corey Haines. Given a set of name/value pairs for a record from a set of records, we must "reconstitute" the whole records. | ||||||||||
For example, given the xml document specified in this snippet: | ||||||||||
|
||||||||||
the result will be: | ||||||||||
|
||||||||||
This snippet illustrates selecting distinct values by sorting, and also how to generate "plain text". | ||||||||||
It also demonstrates how to produce a comma-separated list of items (every row). | ||||||||||
Note how two xsl:variables are defined and used in two nested xsl:for-each loops in order to produce the two-dimensional table. | ||||||||||
XML Source | ||||||||||
XSL Stylesheet | ||||||||||
XML/HTML Result: | ||||||||||
Text Result: | ||||||||||